package com.qianyu.project.web.controller.gsl;

import com.qianyu.project.entity.OpenCompany;
import com.qianyu.project.service.IOpenCompanyService;
import com.qianyu.project.utils.Result;
import com.qianyu.project.utils.ResultTool;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 发票开票登记表 Mapper 接口
 * </p>
 *
 * @author gs
 * @since 2021-01-30
 */
@RestController
@RequestMapping("/opencompany")
public class OpenCompanyContrller {
    @Autowired
    IOpenCompanyService is;

    @GetMapping("/all")
    public Result list(OpenCompany i){
        System.out.println("=="+i.toString());
        return ResultTool.success(is.list(i));
    }
    @GetMapping("{id}")
    public Result listByid(@PathVariable("id") String id){
        return ResultTool.success(is.getById(id));
    }
    @PostMapping("")
    public Result add(@RequestBody OpenCompany i){
        return ResultTool.success(is.add(i));
    }
    @PutMapping("")
    public Result update(OpenCompany i){
        return ResultTool.success(is.update(i));
    }
    @DeleteMapping("{id}")
    public Result delete(@PathVariable("id") String id){
        return ResultTool.success(is.remove(id));
    }
}
